package com.sdy.dao.mysql;

import com.sdy.po.Specification;
import com.sdy.po.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SpecificationMapper {

    List<Specification> getAll();

    Boolean update(@Param("product")Specification specification);

    Boolean insert(@Param("product")Specification specification);

    Boolean delete(@Param("id")Integer id);

    /**
     * 根据id获取规格
     * @param id
     * @return
     */
    @Select("select id,specification,price from po_Specification where id=#{id}")
    Specification getOneById(@Param("id")Integer id);

    /**
     * 根据产品id获得一个产品的所有规格
     * @param productId
     * @return
     */
    @Select("select id,productId,specification,price from po_Specification where productId=#{productId}")
    List<Specification> getListByProductId(@Param("productId")Integer productId);
}
